/**
 * @copyright Copyright (c) 2025 CSG Digital Grid Technology (Guangdong) Co., Ltd.
 * @author Xie Jinhui
 */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CONFIG_H
#define __CONFIG_H

#include <stdint.h>
/**json*/
#include "cJSON.h"

#define CONFIG_FILE_DIR "/userdata/middleware/etc/devinfo/devinfo.conf"
#define DEV_INFO_LEN 256

/* 操作系统和芯片类型 */
#define  	MTK_OPENWRT 	1			
#define		FX_OPENWRT		2
#define     T5_OPENWRT		3
#define		D9_OPENWRT		4
#define		MTK_EULAR 		11
#define		FX_EULAR		12
#define		T5_EULAR		13
#define		D9_EULAR 		14

typedef struct
{
	char deviceType[DEV_INFO_LEN];
	char vendor[DEV_INFO_LEN];
	char overlayVersion[DEV_INFO_LEN];
	char firmwareVersion[DEV_INFO_LEN];
	char factureOverlayVersion[DEV_INFO_LEN];
	char nodeId[DEV_INFO_LEN];
} deviceTypeDef;

extern deviceTypeDef deviceConfig;
extern uint8_t get_configuration(void);
int check_firmware_version(char *firmware_version);
uint8_t getConfig(uint8_t *stringbuff, const char *filedir, int maxlen);
cJSON *string2Json(uint8_t *str);
int set_configinfo(const char *coninfo);
#endif /* __CONFIG_H */